// 存储公共数据的vuex

import { CityListAPI } from "@/api/adminstare";
const state = {
    cityArr: [],// 城市列表
}

const mutations = {
    SETCITYLIST(state, cityArr) { 
        state.cityArr = cityArr
    }
}

const actions = {
    getCityList({ commit }) {
        return new Promise((resolve, reject) => { 
            CityListAPI({ action:'cityList'}).then(res => { 
                commit('SETCITYLIST',res.data)
                resolve(res.data)
            }, err => { 
                reject(err)
            });
        })
    },
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}


